import { BaseWindow } from "../../../component/window/BaseWindow";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { Language } from "../../../../extend/language/Language";
import { ObjCreate } from "../common/ObjCreate";
import { GTextFormat } from "../../../common/GTextFormat";
import { MsgManager } from "../../manager/MsgManager";
import { PulseSharedObject } from "../player/PulseSharedObject";
import { WardrobeType } from "./WardrobeType";
import { TextInput } from "../../../../fl/controls/TextInput";
import { GCheckBox } from "../../../../com/mui/controls/GCheckBox";
import { GButton } from "../../../../com/mui/controls/GButton";
type int = number;
//class WardrobeDeleteWindow
    
    export  class WardrobeDeleteWindow extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            if (WardrobeDeleteWindow._instance != null) 
            {
                throw new Error("tipsWindow");
            }
            setSize(300, 190);
            title = Language.getString(30149);
            titleHeight = 30;
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(17, 42, 265, 135, this);
            this._textfield = ObjCreate.createTextField("", 20, 55, 260, 80, this, new GTextFormat("", 12, 16777215, null, null, null, null, null, flash.text.TextFormatAlign.CENTER));
            this._textfield.wordWrap = true;
            this._textfield.multiline = true;
            var loc1=new GTextFormat("", 12, 16711680);
            ObjCreate.createTextField(Language.getString(36192), 40, 80, 150, 20, this, loc1);
            this._txtSureInput = ObjCreate.createGTextInput(120, 80, 80, 20, this);
            this._tipTxt = ObjCreate.createTextField("", 40, 105, 250, 20, this, loc1);
            this._sureBtn = ObjCreate.createGButton(Language.getString(30151), 85, 125, 50, 25, this);
            this._sureBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onSureBtnClickHandler);
            this._cancelBtn = ObjCreate.createGButton(Language.getString(30152), 165, 125, 50, 25, this);
            this._cancelBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onCancelBtnClickHandler);
            this._notTipCb = ObjCreate.createCheckBox(Language.getString(30150), 50, 155, 100, 20, this);
            this._notTipCb.addEventListener(flash.events.Event.CHANGE, this.onNotTipCbChangeHandler);
            return;
        }

        /* internal  */onSureBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._txtSureInput.text != "del") 
            {
                MsgManager.showRollTipsMsg(Language.getString(36193));
                return;
            }
            if (this._eventFunction != null) 
            {
                this._eventFunction();
            }
            this.hide();
            return;
        }

        /* internal  */onCancelBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        /* internal  */onNotTipCbChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            if (this._notTipCb.selected != true) 
            {
                PulseSharedObject.saveValue(this._notTipsKey, false);
            }
            else 
            {
                PulseSharedObject.save(this._notTipsKey, true);
            }
            return;
        }

        public updateInfo(arg1: int, arg2: string, arg3: Function=null): void
        {
            var loc1="";
            var loc2="";
            if (arg1 != WardrobeType.WardrobeFashion) 
            {
                if (arg1 != WardrobeType.WardrobeWing) 
                {
                    if (arg1 != WardrobeType.WardrobeFashionWeapon) 
                    {
                        if (arg1 != WardrobeType.WardrobeFootPrint) 
                        {
                            if (arg1 != WardrobeType.WardrobeBubble) 
                            {
                                if (arg1 != WardrobeType.WardrobeSurroung) 
                                {
                                    if (arg1 != WardrobeType.WardrobeWaistBelt) 
                                    {
                                        if (arg1 == WardrobeType.WardrobeElf) 
                                        {
                                            loc1 = Language.getString(74725);
                                            loc2 = Language.getString(74726);
                                        }
                                    }
                                    else 
                                    {
                                        loc1 = Language.getString(74715);
                                        loc2 = Language.getString(74716);
                                    }
                                }
                                else 
                                {
                                    loc1 = Language.getString(71475);
                                    loc2 = Language.getString(71476);
                                }
                            }
                            else 
                            {
                                loc1 = Language.getString(71458);
                                loc2 = Language.getString(71459);
                            }
                        }
                        else 
                        {
                            loc1 = Language.getString(71411);
                            loc2 = Language.getString(71412);
                        }
                    }
                    else 
                    {
                        loc1 = Language.getString(36198);
                        loc2 = Language.getString(36199);
                    }
                }
                else 
                {
                    loc1 = Language.getString(36196);
                    loc2 = Language.getString(36197);
                }
            }
            else 
            {
                loc1 = Language.getString(36194);
                loc2 = Language.getString(36195);
            }
            this._textfield.htmlText = loc1;
            this._tipTxt.htmlText = loc2;
            this._eventFunction = arg3;
            this._notTipsKey = arg2;
            this._txtSureInput.text = "";
            this._notTipCb.selected = false;
            return;
        }

        public /* override */ hide(): void
        {
            super.hide();
            this._eventFunction = null;
            return;
        }

        public static get instance(): WardrobeDeleteWindow
        {
            if (WardrobeDeleteWindow._instance == null) 
            {
                WardrobeDeleteWindow._instance = new WardrobeDeleteWindow();
            }
            return WardrobeDeleteWindow._instance;
        }

        /* internal */ /* var */_textfield: Object /* flash.text.TextField */;

        /* internal */ /* var */_txtSureInput: TextInput;

        /* internal */ /* var */_tipTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_notTipCb: GCheckBox;

        /* internal */ /* var */_notTipsKey: string;

        /* internal */ /* var */_sureBtn: GButton;

        /* internal */ /* var */_cancelBtn: GButton;

        /* internal */ /* var */_eventFunction: Function=null;

        /* internal */ static /* var */_instance: WardrobeDeleteWindow;
    }
